% araim

HestenesJacobiApplication($r_1$ : sparse vector with $length_1$ tuples, $r_2$ : sparse vector with $length_2$
tuples,
$g$ : $r_1 \cdot r_2$, $c$ : cosine of rotation, $s$: sine of rotation)

\begin{algorithmic}
\IF {$r_1 = r_2$}
\STATE return
\ENDIF

\WHILE{$j_1 \leq length_1$ and $j_2 \leq length_2$}
  \IF {$i_{1, j_1} < i_{2, j_2}$}
    \STATE $j_1 \gets j_1 + 1$
  \ELSIF {$i_{1, j_1} > i_{2, j_2}$}
    \STATE $j_2 \gets j_2 + 1$
  \ELSE
    \STATE $temp_1 = v_{1, j_1}$
    \STATE $temp_2 = v_{2, j_2}$
    \STATE $v_{1, j_1} = c \cdot temp_1 - s \cdot temp_2$
    \STATE $v_{2, j_2} = c \cdot temp_1 + s \cdot temp_2$
  \ENDIF
\ENDWHILE

\end{algorithmic}

